<template>
  <div class="container order-detail">
    <div class="main">
      <el-form :model="detail" :rules="{}" ref="information" label-width="150px" class="">
        <div class="sub_title">订单信息</div>
        <el-form-item label="订单类型" prop="plateEnable">{{detail.orderType == 'general' ? '普通订单' : '' || '暂无信息'}}</el-form-item>
        <el-form-item label="订单号" prop="plateEnable">{{detail.orderCode || '暂无信息'}}</el-form-item>
        <el-form-item label="订单状态" prop="plateEnable">{{statusDict[detail.orderStatus] || '暂无信息'}}</el-form-item>
        <el-form-item label="订单积分" prop="plateEnable">{{detail.totalPrice || '暂无信息'}}</el-form-item>
        <!-- <el-form-item label="优惠金额" prop="plateEnable">{{getDetail.discountPrice ? detail.discountPrice : '暂无'}}</el-form-item> -->
        <el-form-item label="需付积分" prop="plateEnable">{{detail.totalPrice ? detail.totalPrice : '暂无'}}</el-form-item>
        <el-form-item label="实付积分" prop="plateEnable">{{detail.actualPrice || '暂无信息'}}</el-form-item>
        <div class="sub_title">用户信息</div>
        <el-form-item label="User ID" prop="plateEnable">{{detail.userId || '暂无信息'}}</el-form-item>
        <el-form-item label="手机号" prop="plateEnable">{{detail.userMobile || '暂无信息'}}</el-form-item>
        <div class="sub_title">订单进度</div>
        <el-form-item label="下单时间" prop="plateEnable">
          {{detail.gmtCreated || '暂无信息'}}
        </el-form-item>
        <el-form-item label="支付时间" prop="plateEnable">
          {{detail.payTime || '暂无信息'}}
        </el-form-item>
        <el-form-item label="发货时间" prop="plateEnable">

        </el-form-item>
        <el-form-item label="收货时间" prop="plateEnable">
          {{detail.receiveTime || '暂无信息'}}
        </el-form-item>
        <div class="sub_title">支付信息</div>
        <!-- <el-form-item label="支付流水号" prop="plateEnable"></el-form-item> -->
        <el-form-item label="支付方式" prop="plateEnable">{{detail.payType || '暂无'}}</el-form-item>
        <el-form-item label="支付积分" prop="plateEnable">{{detail.actualPrice || '暂无'}}</el-form-item>
        <div class="sub_title">配送信息</div>
        <el-form-item label="收货人" prop="plateEnable">{{detail.contactName || '暂无信息'}}</el-form-item>
        <el-form-item label="手机号码" prop="plateEnable">{{detail.telNumber || '暂无信息'}}</el-form-item>
        <el-form-item label="收货地区" prop="plateEnable">{{detail.address || '暂无信息'}}</el-form-item>
        <el-form-item label="详细地址" prop="plateEnable">{{detail.detailedAddress || '暂无信息'}}</el-form-item>
        <template v-if="detail.orderStatus != 'WAIT_SEND'||detail.orderStatus != 'WAIT_PAY'||detail.orderStatus != 'CANCEL_TIMEOUT'">
          <div class="sub_title">快递信息</div>
          <el-form-item label="物流公司" prop="plateEnable">{{detail.logisticsCompany || '暂无信息'}}</el-form-item>
          <el-form-item label="物流单号" prop="plateEnable">{{detail.logistics || '暂无信息'}}</el-form-item>
          <el-form-item label="备注" prop="plateEnable">{{detail.sellerMemo || '暂无信息'}}</el-form-item>
        </template>
        <div class="sub_title">备注信息</div>
        <el-form-item label="买家备注" prop="plateEnable"></el-form-item>
        <div class="sub_title">商品信息</div>
        <el-form-item label="商品信息">
          <el-table
            :data="detail.orderItems"
            :border='true'>
            <el-table-column type="index" label="序号"></el-table-column>
            <el-table-column prop="productTitle" label="商品名称"></el-table-column>
            <el-table-column prop="modelName" label="规格"></el-table-column>
            <el-table-column prop="modelSalePrice" label="单价（积分）"></el-table-column>
            <el-table-column prop="count" label="数量"></el-table-column>
            <el-table-column prop="totalPrice" label="小计（积分）"></el-table-column>
            <el-table-column prop="supplier" label="供应商"></el-table-column>
          </el-table>
        </el-form-item>
        <el-form-item style="margin-top: 20px;">
          <el-button type="primary" @click="back()">返回</el-button>
        </el-form-item>
      </el-form>
    </div>
  </div>


</template>

<script>
  let CONSTANT = require('../../constant/constant.js');
  let common = require("../../common.js");
  import $ from 'jquery'
  export default {
    data() {
      return {
        detail: {},
        message: "",
        statusDict: {
          "WAIT_SEND":"待发货",
          "WAIT_PAY": "未支付",
          "PART_SEND": "部分发货",
          "WAIT_GET": "待收货",
          "EVALUATION": "待评价",
          "COMPLETED": "已完成",
          "CANCEL_USER": "用户主动取消",
          "CANCEL_ADMIN": "后台取消",
          "CANCEL_TIMEOUT": "超时取消"
        },
      };
    },
    components:{
    },
    mounted() {
      this.getDetail()
    },
    methods: {
      getDetail(){
        let url = CONSTANT.URL.ORDER.orderDetail
        common.get(url, this.$route.query.orderCode, res => {
          if (res.code == 200) {
            this.detail = res.data.bussData
            this.message = res.data.bussData.sellerMemo
          }
        })
      },
      handleRemark() {
        let url = CONSTANT.URL.ORDER.orderRemark
        common.get(url, this.detail.id+"/"+this.message, res => {
          if (res.code == 200) {
            this.$message({
              type: "success",
              message: "修改备注成功"
            })
            this.dialogVisible = false
            this.getDetail()
          }
        })
      },
      editorInfo(val){
        this.information.detail = val;
      },
      resetForm(formName) {this.$refs[formName].resetFields();},
      back(){ this.$router.back()  },
    }
  }
</script>
<style lang="scss">
  .container .main .el-form-item {
    margin-bottom: 0px;
  }
  .order-detail {
    .el-form-item__label {
      text-align: left;
      color: #A5A5A5;
      margin-left: 60px;
    }
    .el-form-item{
      margin-bottom: 5px!important;
    }
    .el-form-item__label {
      text-align: left;
      margin-left: 60px;
    }
  }
</style>
